import {
  handlerGetUrlParams
} from '@/utils/dealUrlParams.js'
import request from '@/utils/request'

export function getAccountList(param, data) {
  const url = handlerGetUrlParams('/system/user/list', param)
  return request({
    url,
    method: 'POST',
    data
  })
}

export function deleteAccount(ids) {
  return request({
    url: `/system/user/${ids}`,
    method: 'DELETE',
  })
}

export function getSelfIfo(param) {
  return request({
    url: `/system/user/`+param,
    method: 'GET',
  })
}

export function getAccountDetail(ids) {
  return request({
    url: `/system/user/${ids}`,
    method: 'GET',
  })
}

export function updatePwd(data) {
  const url = handlerGetUrlParams('/system/user/profile/updatePwd', data)
  return request({
    url: url,
    method: 'PUT',
    data
  })
}

export function personAuth(data) {
  return request({
    url: '/system/user/profile/person',
    method: 'PUT',
    data
  })
}

export function companyAuth(data) {
  return request({
    url: '/system/user/profile/enterprise',
    method: 'PUT',
    data
  })
}

//富文本使用
export function upload(data) {
  return request({
    url: '/system/file/pop',
    method: 'POST',
    headers: {
      'Content-Type': 'multipart/form-data'
    },
    data
  })
}

export function editUserInfo(data) {
  return request({
    url: '/system/user/profile',
    method: 'PUT',
    data
  })
}